using System;

using SBPweb.Data;

namespace SBPweb.PROvibe.Resources.Entities
{
	public class Page: Entity, IPage
	{

		#region Private fields

		private const string FIELDNAME_Id = "Id";
		private const string FIELDNAME_Name = "Name";

		#endregion

		#region Constructor logic

		static Page()
		{
			RegisterEntityTypeToColumns(typeof(Page));
		}

		public Page()
            : base(null)
        {
		}

        public Page(Page entity)
            : base(entity)
        {
        }

		#endregion

		#region Public property accessors

		public virtual int Id
		{
			get
			{
				return GetValue<Int32>(FIELDNAME_Id);
			}
			set
			{
				SetValue<Int32>(FIELDNAME_Id, value);
			}
		}

		public virtual string Name
		{
			get
			{
				return GetValue<String>(FIELDNAME_Name);
			}
			set
			{
				SetValue<String>(FIELDNAME_Name, value);
			}
		}

		#endregion

		#region Overridden methods

		public override object Clone()
		{
			throw new Exception("The method or operation is not implemented.");
		}

        public int CompareTo(IEntity other)
        {
            IPage o = other as IPage;
            if (o == null)
            {
                return 0;
            }
            return this.Id.CompareTo(o.Id);
        }

        public bool Equals(IEntity other)
        {
            IPage o = other as IPage;
            if (o == null)
            {
                return false;
            }
            return this.Id.Equals(o.Id);
        }

		#endregion

	}
}
